package com.whmskj.xjlhsc.controller;

import cn.dev33.satoken.annotation.SaIgnore;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import com.whmskj.xjlhsc.entity.EquipmentMtnPlanAllocation;
import com.whmskj.xjlhsc.service.EquipmentMtnPlanAllocationService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.GetMapping;

import java.math.BigDecimal;
import java.util.List;

/**
 * 设备维保机台分配表
 *
 * @author lk
 * @since 2025-06-10 14:48:04
 */
@RestController
@RequestMapping("/api/equipmentMtnPlanAllocation")
@SaIgnore
public class EquipmentMtnPlanAllocationController {

    @Autowired
    private EquipmentMtnPlanAllocationService equipmentMtnPlanAllocationService;

    /**
     * 分页查询
     *
     * @param params
     * @return
     */
    @PostMapping("/findPage")
    public ResponseEntity<Page<EquipmentMtnPlanAllocation>> findPage(@RequestBody EquipmentMtnPlanAllocation params) {
        Page<EquipmentMtnPlanAllocation> result = equipmentMtnPlanAllocationService.findPage(params);
        return ResponseEntity.ok(result);
    }
    /**
     * 列表查询
     *
     * @param params
     * @return
     */
    @PostMapping("/findList")
    public ResponseEntity<List<EquipmentMtnPlanAllocation>> findList(@RequestBody EquipmentMtnPlanAllocation params) {
        List<EquipmentMtnPlanAllocation> result = equipmentMtnPlanAllocationService.findList(params);
        return ResponseEntity.ok(result);
    }

    /**
     * 查询
     *
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    public ResponseEntity<EquipmentMtnPlanAllocation> findById(@PathVariable("id") Long id) {
        EquipmentMtnPlanAllocation equipmentMtnPlanAllocation = equipmentMtnPlanAllocationService.findById(id);
        return ResponseEntity.ok(equipmentMtnPlanAllocation);
    }

    /**
     * 新增
     *
     * @param equipmentMtnPlanAllocation‌
     * @return
     */
    @PostMapping
    public ResponseEntity<Boolean> insert( @RequestBody EquipmentMtnPlanAllocation equipmentMtnPlanAllocation) {
        boolean result = equipmentMtnPlanAllocationService.insert(equipmentMtnPlanAllocation);
        return ResponseEntity.ok(result);
    }

    /**
     * 修改
     *
     * @param equipmentMtnPlanAllocation‌
     * @return
     */
    @PutMapping
    public ResponseEntity<Boolean> update( @RequestBody EquipmentMtnPlanAllocation equipmentMtnPlanAllocation) {
        boolean result = equipmentMtnPlanAllocationService.update(equipmentMtnPlanAllocation);
        return ResponseEntity.ok(result);
    }

    /**
     * 删除
     *
     * @param id
     * @return
     */
    @DeleteMapping("/{id}")
    public ResponseEntity<Integer> delete(@PathVariable("id") Long id) {
        int result = equipmentMtnPlanAllocationService.delete(id);
        return ResponseEntity.ok(result);
    }

}